import type { IFieldProps, IConfigProps } from '@/components/sofastui/AdvancedTable/interface'
import type { FormRule } from '@form-create/element-ui'

export const fields: IFieldProps[] = [
  {
    label: '数据类型',
    prop: 'dataType',
    width: 100,
    import: true,
    export: true,
  },
  {
    label: '名称',
    prop: 'name',
    minWidth: 60,
    import: true,
    export: true,
  },
  {
    label: '备注',
    prop: 'desc',
    minWidth: 60,
    import: true,
    export: true,
  },
  {
    label: '标签颜色',
    prop: 'tagColor',
    minWidth: 60,
    import: true,
    export: true,
    slot: true,
  },
  {
    label: '创建时间',
    prop: 'createdAt',
    width: 180,
    import: true,
    export: true,
  },
]

export const config: IConfigProps = {
  name: 'sysDictTable',
  rowKey: 'id',
  url: '/api/sys/dict',
  selection: true,
  add: true,
  delete: true,
  expand: true,
  showIndex: true,
  import: true,
  export: true,
  search: true,
  advancedSearch: true,
  refresh: true,
  settings: true,
}

export const formRules: FormRule = [
  {
    type: 'select',
    field: 'type',
    title: '字典类型',
    effect: {
      fetch: '',
    },
    options: [
      {
        label: '系统类',
        value: 0,
      },
      {
        label: '业务类',
        value: 1,
      },
    ],
    $required: true,
    props: {
      clearable: true,
    },
    _fc_id: 'id_Fwh5mc35zbnbchc',
    name: 'type',
    display: true,
    hidden: false,
    _fc_drag_tag: 'select',
    col: {
      span: 12,
    },
  },
  {
    type: 'input',
    field: 'name',
    title: '字典名称',
    $required: true,
    props: {
      placeholder: '请输入字典名称',
    },
    _fc_id: 'id_F11bmc34zpa2bnc',
    name: 'name',
    display: true,
    hidden: false,
    _fc_drag_tag: 'input',
    col: {
      span: 12,
    },
  },
  {
    type: 'select',
    field: 'dataType',
    title: '数据类型',
    effect: {
      fetch: '',
    },
    options: [
      {
        label: '数值',
        value: 'number',
      },
      {
        label: '字符串',
        value: 'string',
      },
      {
        label: '布尔值',
        value: 'boolean',
      },
    ],
    $required: true,
    props: {
      clearable: true,
    },
    _fc_id: 'id_Fwh3sc35zbnbchc',
    name: 'dataType',
    display: true,
    hidden: false,
    _fc_drag_tag: 'select',
    col: {
      span: 12,
    },
  },
  {
    type: 'input',
    field: 'desc',
    title: '字典描述',
    $required: false,
    props: {
      type: 'textarea',
      placeholder: '请输入字典描述',
    },
    _fc_id: 'id_Fwn9mc22xutzaoc',
    name: 'desc',
    display: true,
    hidden: false,
    _fc_drag_tag: 'textarea',
    col: {
      span: 24,
    },
  },
]
